package com.ruoyi.web.controller.system;


import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.samplemod.domain.entity.EmilSystem;
import com.ruoyi.samplemod.service.SysEmilService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/system/Email")
public class SysEmilController {

    @Autowired
    SysEmilService sysEmilService;
    Long menu_id;

    @PostMapping("/getUserByDeptIds")
    public List<SysUser> getUserByDeptIds(@RequestBody List<String> deptIdList){
        return sysEmilService.getUserByDeptIds(deptIdList);
    }

    @GetMapping("/getSystemMenu")
    public List<SysMenu> getSystemMenu(){
        return sysEmilService.getSystemMenu();
    }

    @GetMapping("/querySystemUser")
    public List<EmilSystem> querySystemUser(@RequestParam("") Long menuId){
        this.menu_id=menuId;
        return sysEmilService.querySystemUser(menuId);
    }

    @PutMapping("/setUserEmailSystem")
    public String setUserEmilSystem(@RequestBody List<Long> userIdList ){
        if (menu_id==null){
            return "请刷新";
        }
        sysEmilService.setUserEmilSystem(userIdList,menu_id);
        return "修改成功";
    }
}
